//
//  FragmentDetailViewController.m
//  SimpleTimeDemo
//
//  Created by lanou3g on 15/11/18.
//  Copyright © 2015年 王丽珍. All rights reserved.
//

#import "FragmentDetailViewController.h"
#import "MainDataHelper.h"
#import "TopicModel.h"

@interface FragmentDetailViewController ()

@property (nonatomic, strong) NSMutableArray *dataArray;

@property (nonatomic, copy) NSString *string;
@property (nonatomic, copy) NSString *bodyString;

@property (nonatomic, strong) UIWebView *webView;

@end

@implementation FragmentDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.webView = [[UIWebView alloc] initWithFrame:self.view.frame];
    
    [self.view addSubview:self.webView];
    
    self.string = @"http://api2.pianke.me/timeline/info";
    self.bodyString = [NSString stringWithFormat:@"auth=XMBrRynjpvhDC8h8GsDrkzJxQMf6PLKEpG44WTxhcWP22NJOTRRf4fg&client=1&contentid=%@&deviceid=4B1DC887-3B93-405F-970B-3B2C4C556E2A&version=3.0.6",self.contentid];
    [MainDataHelper postDataWithUrlString:self.string andBodyString:self.bodyString compare:^(id object) {
        NSDictionary *dic = object;
        TopicModel *model = [[TopicModel alloc] init];
        model.html = dic[@"data"][@"html"];
        [self.webView loadHTMLString:model.html baseURL:nil];
    }];
}











- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
